package com.mxpio.erp.technology.service.impl;

import com.mxpio.erp.common.technology.entity.*;
import com.mxpio.erp.common.technology.service.WorkTeamMemberService;
import com.mxpioframework.jpa.JpaUtil;
import com.mxpioframework.jpa.query.Criteria;
import com.mxpioframework.security.entity.User;
import com.mxpioframework.system.service.impl.BaseServiceImpl;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * @author wupaa
 */
@Service
public class WorkTeamMemberServiceImpl extends BaseServiceImpl<WorkTeamMember> implements WorkTeamMemberService {
    @Override
    @Transactional
    public Page<User> getUnrelatedMemberPage(String workTeamCode,Pageable pageAble, Criteria criteria) {
        return JpaUtil
                .linq(User.class)
                .notExists(WorkTeamMember.class)
                    .equalProperty("memberId", "username")
                    .equal("workTeamCode", workTeamCode)
                .end()
                .where(criteria)
                .paging(pageAble);
    }

}
